<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php /** @var $block \Magento\Shipping\Block\Adminhtml\Order\Packaging */ ?>
<div id="packaging_window">
    <div class="message message-warning" style="display: none"></div>
    <section class="admin__page-section" id="package_template" style="display:none;">
        <div class="admin__page-section-title">
            <span class="title">
                <?php /* @escapeNotVerified */ echo __('Package') ?> <span data-role="package-number"></span>
            </span>
            <div class="actions _primary">
                <button type="button" class="action-secondary" data-action="package-save-items" onclick="packaging.packItems(this);">
                    <span><?php /* @escapeNotVerified */ echo __('Add Selected Product(s) to Package') ?></span>
                </button>
                <button type="button" class="action-secondary" data-action="package-add-items" onclick="packaging.getItemsForPack(this);">
                    <span><?php /* @escapeNotVerified */ echo __('Add Products to Package') ?></span>
                </button>
            </div>
        </div>
        <div class="admin__control-table-wrapper admin__page-subsection">
            <table class="data-table admin__control-table">
                <thead>
                    <tr>
                        <th class="col-type"><?php /* @escapeNotVerified */ echo __('Type') ?></th>
                        <?php if ($girthEnabled == 1): ?>
                        <th class="col-size"><?php /* @escapeNotVerified */ echo __('Size') ?></th>
                        <th class="col-girth"><?php /* @escapeNotVerified */ echo __('Girth') ?></th>
                        <th>&nbsp;</th>
                        <?php endif; ?>
                        <th class="col-custom" <?php echo $block->displayCustomsValue() ? '' : 'style="display: none;"' ?>>
                            <?php /* @escapeNotVerified */ echo __('Customs Value') ?>
                        </th>
                        <th class="col-total-weight"><?php /* @escapeNotVerified */ echo __('Total Weight') ?></th>
                        <th class="col-length"><?php /* @escapeNotVerified */ echo __('Length') ?></th>
                        <th class="col-width"><?php /* @escapeNotVerified */ echo __('Width') ?></th>
                        <th class="col-height"><?php /* @escapeNotVerified */ echo __('Height') ?></th>
                        <th>&nbsp;</th>
                        <?php if ($block->getDeliveryConfirmationTypes()): ?>
                        <th class="col-signature"><?php /* @escapeNotVerified */ echo __('Signature Confirmation') ?></th>
                            <?php endif; ?>
                        <th class="col-actions">&nbsp;</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td class="col-type">
                            <?php $containers = $block->getContainers(); ?>
                            <select name="package_container"
                                    onchange="packaging.changeContainerType(this);packaging.checkSizeAndGirthParameter(this, <?php /* @escapeNotVerified */ echo  $girthEnabled ?>);"
                                    <?php if (empty($containers)):?>
                                        title="<?php /* @escapeNotVerified */ echo __('USPS domestic shipments don\'t use package types.') ?>"
                                        disabled=""
                                        class="admin__control-select disabled"
                                    <?php else: ?>
                                        class="admin__control-select"
                                    <?php endif; ?>>
                                <?php foreach ($block->getContainers() as $key => $value): ?>
                                    <option value="<?php /* @escapeNotVerified */ echo $key ?>" >
                                        <?php /* @escapeNotVerified */ echo $value ?>
                                    </option>
                                <?php endforeach; ?>
                            </select>
                        </td>
                        <?php if ($girthEnabled == 1 && !empty($sizeSource)): ?>
                        <td>
                            <select name="package_size"
                                    class="admin__control-select"
                                    onchange="packaging.checkSizeAndGirthParameter(this, <?php /* @escapeNotVerified */ echo  $girthEnabled ?>);">
                                <?php foreach ($sizeSource as $key => $value): ?>
                                <option value="<?php /* @escapeNotVerified */ echo $sizeSource[$key]['value'] ?>">
                                    <?php /* @escapeNotVerified */ echo $sizeSource[$key]['label'] ?>
                                </option>
                                <?php endforeach; ?>
                            </select>
                        </td>
                        <td>
                            <input type="text"
                                   class="input-text admin__control-text validate-greater-than-zero"
                                   name="container_girth" />
                        </td>
                        <td>
                            <select name="container_girth_dimension_units"
                                    class="options-units-dimensions measures admin__control-select"
                                    onchange="packaging.changeMeasures(this);">
                                <option value="<?php /* @escapeNotVerified */ echo Zend_Measure_Length::INCH ?>" selected="selected" ><?php /* @escapeNotVerified */ echo __('in') ?></option>
                                <option value="<?php /* @escapeNotVerified */ echo Zend_Measure_Length::CENTIMETER ?>" ><?php /* @escapeNotVerified */ echo __('cm') ?></option>
                            </select>
                        </td>
                            <?php endif; ?>
                        <?php
                        if ($block->displayCustomsValue()) {
                            $customsValueDisplay = '';
                            $customsValueValidation = ' validate-zero-or-greater ';
                        } else {
                            $customsValueDisplay = ' style="display: none;" ';
                            $customsValueValidation = '';
                        }
                        ?>
                        <td class="col-custom" <?php /* @escapeNotVerified */ echo $customsValueDisplay ?>>
                            <div class="admin__control-addon">
                                <input type="text"
                                       class="customs-value input-text admin__control-text <?php /* @escapeNotVerified */ echo $customsValueValidation ?>"
                                       name="package_customs_value" />
                                <span class="admin__addon-suffix">
                                    <span class="customs-value-currency"><?php /* @escapeNotVerified */ echo $block->getCustomValueCurrencyCode(); ?></span>
                                </span>
                            </div>
                        </td>
                        <td class="col-total-weight">
                            <div class="admin__control-addon">
                            <input type="text"
                                   class="options-weight input-text admin__control-text required-entry validate-greater-than-zero"
                                   name="container_weight" />
                                    <select name="container_weight_units"
                                            class="options-units-weight measures admin__control-select"
                                            onchange="packaging.changeMeasures(this);">
                                        <option value="<?php /* @escapeNotVerified */ echo Zend_Measure_Weight::POUND ?>" selected="selected"  ><?php /* @escapeNotVerified */ echo __('lb') ?></option>
                                        <option value="<?php /* @escapeNotVerified */ echo Zend_Measure_Weight::KILOGRAM ?>" ><?php /* @escapeNotVerified */ echo __('kg') ?></option>
                                    </select>
                                <span class="admin__addon-prefix"></span>
                            </div>
                        </td>
                        <td class="col-length">
                            <input type="text"
                                   class="input-text admin__control-text validate-greater-than-zero"
                                   name="container_length" />
                        </td>
                        <td class="col-width">
                            <input type="text"
                                   class="input-text admin__control-text validate-greater-than-zero"
                                   name="container_width" />
                        </td>
                        <td class="col-height">
                            <input type="text"
                                   class="input-text admin__control-text validate-greater-than-zero"
                                   name="container_height" />
                        </td>
                        <td class="col-measure">
                            <select name="container_dimension_units"
                                    class="options-units-dimensions measures admin__control-select"
                                    onchange="packaging.changeMeasures(this);">
                                <option value="<?php /* @escapeNotVerified */ echo Zend_Measure_Length::INCH ?>" selected="selected" ><?php /* @escapeNotVerified */ echo __('in') ?></option>
                                <option value="<?php /* @escapeNotVerified */ echo Zend_Measure_Length::CENTIMETER ?>" ><?php /* @escapeNotVerified */ echo __('cm') ?></option>
                            </select>
                        </td>
                        <?php if ($block->getDeliveryConfirmationTypes()): ?>
                        <td>
                            <select name="delivery_confirmation_types" class="admin__control-select">
                                <?php foreach ($block->getDeliveryConfirmationTypes() as $key => $value): ?>
                                <option value="<?php /* @escapeNotVerified */ echo $key ?>" >
                                    <?php /* @escapeNotVerified */ echo $value ?>
                                </option>
                                <?php endforeach; ?>
                            </select>
                        </td>
                            <?php endif; ?>
                        <td class="col-actions">
                            <button type="button" class="action-delete DeletePackageBtn" onclick="packaging.deletePackage(this);">
                                <span><?php /* @escapeNotVerified */ echo __('Delete Package') ?></span>
                            </button>
                        </td>
                    </tr>
                </tbody>
            </table>
            <?php if ($block->getContentTypes()): ?>
                <table class="data-table admin__control-table" cellspacing="0">
                    <thead>
                        <tr>
                            <th><?php /* @escapeNotVerified */ echo __('Contents') ?></th>
                            <th><?php /* @escapeNotVerified */ echo __('Explanation') ?></th>
                        </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td>
                            <select name="content_type"
                                    class="admin__control-select"
                                    onchange="packaging.changeContentTypes(this);">
                                <?php foreach ($block->getContentTypes() as $key => $value): ?>
                                    <option value="<?php /* @escapeNotVerified */ echo $key ?>" >
                                        <?php /* @escapeNotVerified */ echo $value ?>
                                    </option>
                                <?php endforeach; ?>
                            </select>
                        </td>
                        <td>
                            <input name="content_type_other"
                                   type="text"
                                   class="input-text admin__control-text options-content-type disabled"
                                   disabled="disabled" />
                        </td>
                    </tr>
                    </tbody>
                </table>
            <?php endif; ?>
        </div>
        <div class="admin__page-subsection" data-role="package-items">
            <div class="grid_prepare admin__page-subsection"></div>
        </div>
    </section>
    <div id="packages_content"></div>
</div>
